<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <f:metadata>
        <f:viewParam name="idevent" value="#{eventBean.selectedid}"/>
        <f:viewAction action="#{eventBean.init}"/>
    </f:metadata>
    <h:head>
        <title>Event Detail</title>
    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <p:layoutUnit position="north" size="125" style="border: 0px">
                <h:panelGrid columns="3" style="width: 100%">
                    <h:graphicImage value="/images/Simbolo_Meteocal.png" height="100"/>
                    <h1>Event Detail</h1>

                    <p:button id="modify" value="Go back to your page" outcome="homepage"/>

                </h:panelGrid>
            </p:layoutUnit> 
            <p:layoutUnit position="center">
                <table border="0" cellspacing="10" cellpadding="10">
                    <thead>
                        <tr>
                            <th>
                                <h:form>
                                    <p:commandButton id="modify2" value="Modify the event?" action="#{eventBean.gotoModify()}" disabled="#{eventBean.checkPrivilege()}">
                                        <f:param name="idevent" value="#{eventBean.selectedid}"/>
                                    </p:commandButton>
                                    <p:commandButton id="delete" value="Delete the event?" action="#{eventBean.delete()}" disabled="#{eventBean.checkPrivilege()}">
                                        <f:param name="idevent" value="#{eventBean.selectedid}"/>
                                    </p:commandButton>
                                </h:form>
                                <h:form>
                                    <h:panelGrid columns="2" style="width: 100%">
                                        <div>
                                            Event Author: 
                                            <h:outputLabel id="nameauthor" value="#{eventBean.event.author.name} #{eventBean.event.author.surname}" />
                                            Event Name: 
                                            <h:outputLabel id="nameevent" value="#{eventBean.event.name}"/>
                                            Event Description:
                                            <h:outputText id="descevent" value="#{eventBean.event.description}"/>
                                        </div>
                                        <div>
                                            Event Type:
                                            <h:outputLabel  id="typevent" value="#{eventBean.typeString}"/>
                                        </div>
                                        <div>
                                            Begin Date:
                                            <h:outputLabel id="begindate" value="#{eventBean.beginDate}"/>
                                            End Date:
                                            <h:outputLabel id="enddate" value="#{eventBean.endDate}"/>
                                        </div>
                                        <div>
                                            City: 
                                            <h:outputLabel id="cityevent" value="#{eventBean.event.city}"/>
                                            Country:
                                            <h:outputLabel id="countryevent" value="#{eventBean.event.country}"/>
                                            Address :
                                            <h:outputLabel id="addressevent" value="#{eventBean.event.address}"/>
                                        </div>
                                        <div>
                                            Weather Forecast: 
                                            <h:outputLabel id="weatherevent" value="#{eventBean.forecastText}"/>
                                        </div>
                                    </h:panelGrid>
                                    Partecipants list :
                                    <br/>
                                    <br/>
                                    <p:dataTable var="u" value="#{eventBean.invList}" paginator="true" rowsPerPageLabel="5">
                                        <p:column headerText="User">
                                            <h:outputText value="#{u.user.email}" />
                                        </p:column>
                                        <p:column headerText="Partecipation">
                                            <h:outputText value="#{u.partecipationString}" />
                                        </p:column>
                                    </p:dataTable>
                                </h:form>
                            </th>
                            <th>
                                <h:graphicImage value="#{eventBean.icon}" height="600"/>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>


            </p:layoutUnit>

        </p:layout>
    </h:body>
</html>
